require 'test/unit'
require 'semantictext/default_tag_factory'
require 'semantictext/rich_text_parser'
require 'semantictext/bullet'

class BulletTest < Test::Unit::TestCase

	def assert_element(element_class, text, actual)
		assert_equal element_class, actual.class
		assert_equal text, actual.text
	end

	def test_bullet_line_with_links
	  test_string = "beginning http://www.example.com moretext http://www.dafydd.net ending text"
	  unit = SemanticText::Bullet.new(test_string, 1, SemanticText::RichTextParser.new(SemanticText::DefaultTagFactory.new))
	  assert_equal(1, unit.depth)
	  assert_element SemanticText::Span, "beginning ", unit.content[0]
	  assert_element SemanticText::HTTPTag, "//www.example.com", unit.content[1]
	  assert_element SemanticText::Span, " moretext ", unit.content[2]
	  assert_element SemanticText::HTTPTag, "//www.dafydd.net", unit.content[3]
	  assert_element SemanticText::Span, " ending text", unit.content[4]
	end

end
